<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<%@include file="/common/taglibs.jsp" %>
<%@include file="/common/javascript.jsp" %>
<html>
  <head>
    <base href="<%=basePath%>">
	<style type="text/css">	
		/*提交表单*/
		.l-table-edit {font-size:12px; color:#555; padding:5px 5px 5px 0px;}
		.l-table-edit-td{ padding:5px; padding-left:0;}
	</style>
	
	<script type="text/javascript">
		var viewType='${viewType}';
		$(function(){
			if(viewType=="detail"){
				$("form input").attr("readonly","readonly"); 
				$("form textarea").attr("readonly","readonly");
			}
		});
		
		function saveInfo(){
	
			$("#mainform").form('submit',{
				success: function(data){  
					var data = eval('(' + data + ')'); 
					if (!data.success){ //保存失败  
						$.messager.alert('提示',"错误"+data.message,"info");
        			}else{//保存成功
        				$.messager.alert('提示',data.message,"info",function(){
        						//调用父窗体的方法，关闭弹出框，并刷新网格
        						window.parent.closeContent();
        				});
        			} 
				}
				
			});
		}
	</script>
  </head>
  
  <body>
	<form name="mainform" method="post"  id="mainform" action="manageAction_save">
    	<table cellpadding="0" cellspacing="0" class="l-table-edit" style="width: 95%; margin-top:10px; margin-left:15px; column-gap:8px">
        	<tr>
            	<td align="right" class="l-table-edit-td">用户编号:</td>
                <td align="left" class="l-table-edit-td">
                	<c:if test="${viewType=='detail' }">
                		${ model.num }
                	</c:if>
                	<c:if test="${viewType!='detail' }">
                		<input name="model.num" id="num"  value="${ model.num}" />
                	</c:if>
                	<input name="model.id" type="hidden" id="id"  value="${ model.id}" />
                </td>
            </tr>
            <tr>
             	<td align="right" class="l-table-edit-td"><label class="red">*</label>用户名称:</td>
                <td align="left" class="l-table-edit-td">
                	<input name="model.name" type="text" id="name" value="${ model.name }" datatype="s" altercss="gray" tip="用户名称不能为空" />
                </td>
            	<td align="right" class="l-table-edit-td">用户权限:</td>
                <td align="left" class="l-table-edit-td" colspan="3">
                <select id="perId" class="easyui-combobox" name="perId" style="width: 155px;">
            		<c:forEach items="${permissions}" var="permission">
            			<c:choose>
            				<c:when test="${model.perId.id eq permission.id}">
            					<option value="${permission.id}" selected="selected">${permission.name}</option>
            				</c:when>
            				<c:otherwise>
            					<option value="${permission.id}">${permission.name}</option>
            				</c:otherwise>
            			</c:choose>
            		</c:forEach>
				</select> 
               	</td>
            </tr>
            <tr>
            	<td align="right" class="l-table-edit-td">备注:</td>
                <td align="left" class="l-table-edit-td" colspan="3">
                	<textarea name="model.remark" id="remark" rows="3" style="width: 100%" >${ model.remark }</textarea>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
